import { pageCraft } from '@/api/craft'

const state = {
  crafts: []
}

const mutations = {

  PAGE_CRAFT:(state, data) => {
    state.crafts = data
  }
}

const actions = {
  pageCraft({ commit, state },_data) {
    return new Promise((resolve, reject) => {
      pageCraft(_data).then(data=> {
        commit('PAGE_CRAFT',data)
        resolve()
      }).catch(error => {
        reject(error)
      })
    })
  },
}

export default {
  namespaced: true,
  state,
  mutations,
  actions
}

